﻿module BasicType {
    //boolean
    var isDone: boolean = false;
    //number其实是float
    var height: number = 6.1;
    //string 的2种写法
    var name: string = "bob";
    name = "smith";
    //Arrary的2中写法
    var list: number[] = [1, 2];
    var list: Array<number> = [1, 2];
    //enum（js中没有的）
    enum Color { Red = 0, Green, Blue };
    var c: Color = Color.Green;
    //默认情况下枚举的元素值开始于0，你也可以手动指定
    //开始值
    enum Color1 { Red = 1, Green, Blue };
    //你可从数组去枚举出名称
    var colorName: string = Color[2];
    alert(colorName);
    //any类型
    var notSure: any = 4;
    notSure = "maybe a string instead";
    notSure = false;
    var list1: Array<any> = [1, true, "free"];
    list1[1] = 100;
    //void定义没有任何类型的站位，通常比较常见的是void返回值函数
    function warUser(): void {
        alert("This is may warning message");
    }
    function AA() {
        return "";
    }

}